using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UIManagerBase : MonoBehaviour
{
    public static UIManagerBase Instance;

    protected virtual void Awake()
    {
        Instance = this;
    }

    public T ShowPanel<T>(string path, bool recycle)
    {
        GameObject panelPrefab = Resources.Load<GameObject>(path);
        GameObject panel = GameObjPool.GetGameObject(panelPrefab, recycle);
        panel.transform.SetParent(GameObject.FindGameObjectWithTag("MainUI").transform);
        panel.transform.position = new Vector2(Screen.width / 2, Screen.height / 2);
        panel.transform.localScale = Vector3.one;
        panel.transform.SetAsLastSibling();
        return panel.GetComponent<T>();
    }
}
